package com.app.service.impl;

import com.app.mapper.JobFairCompanyPostMapper;
import com.app.model.JobFairCompanyModel;
import com.app.model.JobFairCompanyPostModel;
import com.app.model.SkillTrainingModel;
import com.app.service.JobFairCompanyPostService;
import com.app.service.JobFairCompanyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:招聘会报名
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class JobFairCompanyPostServiceImpl implements JobFairCompanyPostService {
    @Autowired
    JobFairCompanyPostMapper jobFairCompanyPostMapper;

    @Override
    public int insert(JobFairCompanyPostModel model) {
        return jobFairCompanyPostMapper.insert(model);
    }

    @Override
    public int countBySidAndCid(int sId, int cId) {
        QueryWrapper<JobFairCompanyPostModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("sid", sId);
        queryWrapper.select().eq("cid", cId);
        int count = jobFairCompanyPostMapper.selectCount(queryWrapper);
        return count;
    }

    @Override
    public List<JobFairCompanyPostModel> getListBySidAndCid(int sId, int cId) {
        QueryWrapper<JobFairCompanyPostModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("sid", sId);
        queryWrapper.select().eq("cid", cId);
        List<JobFairCompanyPostModel> userList = jobFairCompanyPostMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public List<JobFairCompanyPostModel> getListBySid(int sId) {
        QueryWrapper<JobFairCompanyPostModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("sid", sId);
        List<JobFairCompanyPostModel> userList = jobFairCompanyPostMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public int countBySid(int sId) {
        QueryWrapper<JobFairCompanyPostModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("sid", sId);
        int count = jobFairCompanyPostMapper.selectCount(queryWrapper);
        return count;
    }

    @Override
    public List<JobFairCompanyPostModel> getLIstByModel(JobFairCompanyPostModel model) {
        return jobFairCompanyPostMapper.getLIstByModel(model);
    }
    @Override
    public int getCountByModel(JobFairCompanyPostModel model) {
        return jobFairCompanyPostMapper.getCountByModel(model);
    }


}
